package com.victor.dao;

import java.util.List;

import javax.persistence.Column;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.victor.entity.Demo;
import com.victor.entity.LookThings;
import com.victor.entity.User;
import com.victor.entity.UserBankcard;

@Mapper
public interface My_bankcardDao {

	/**
	 * 通过用户id查询银行卡列表
	 * @param userid	用户id
	 * @return
	 */
	@Select({ "select * from user_bankcard where userid=#{userid} " })
	List<UserBankcard> selBankcardListByUserid(String userid);

	/**
	 * 通过银行卡id查询银行卡详情
	 * @param id
	 * @return
	 */
	@Select({ "select * from user_bankcard where id=#{id} " })
	UserBankcard bankCardDetail(Integer id);

	/**
	 * 通过用户id获取用户支付密码
	 * @param id
	 * @return
	 */
	@Select({ "select paypassword from user where id=#{id} " })
	String ifpaypassword(Integer id);

	/**
	 * 通过用户id查询用户真实姓名，身份证号
	 * @param id
	 * @return
	 */
	@Select({ "select name,idcard from user where id=#{id} " })
	User selectUserById(Integer id);

	/**
	 * 添加银行卡
	 * @param userBankcard
	 * @return
	 */
	@Insert({ "insert into user_bankcard (userid,bankcardnum,joinbank,cardtype) values (#{userid},#{bankcardnum},#{joinbank},#{cardtype})" })
	Boolean bindBrandCard(UserBankcard userBankcard);

	/**
	 * 通过银行卡id，删除银行卡信息
	 * @param id
	 * @return
	 */
	@Delete({ "delete from user_bankcard where id=#{id} " })
	boolean unbindBrandCard(Integer id);


}
